package com.dmcliver.timetracker.session;

import com.dmcliver.timetracker.entity.*;
import java.util.ArrayList;
import java.util.List;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("jobHome")
public class JobHome extends EntityHome<Job> {

	public void setJobJobname(String id) {
		setId(id);
	}

	public String getJobJobname() {
		return (String) getId();
	}

	@Override
	protected Job createInstance() {
		Job job = new Job();
		return job;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
	}

	public boolean isWired() {
		return true;
	}

	public Job getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

	public List<Timeentry> getTimeentries() {
		return getInstance() == null ? null : new ArrayList<Timeentry>(
				getInstance().getTimeentries());
	}

	public List<Feedback> getFeedbacks() {
		return getInstance() == null ? null : new ArrayList<Feedback>(
				getInstance().getFeedbacks());
	}

}
